from Define import ModulePath, TexPath, SPRITE_POS
from pandac.PandaModules import Point2, Point3

def loadObject(tex = None, pos = Point2(0,0), depth = SPRITE_POS, scale = 1,
               transparency = True):
  obj = loader.loadModel(ModulePath)
  obj.reparentTo(camera)
  obj.setPos(Point3(pos.getX(), depth, pos.getY()))
  obj.setScale(scale)
  obj.setBin("unsorted", 0)
  obj.setDepthTest(False)
  if transparency:
      obj.setTransparency(1)
  if tex:
    tex = loader.loadTexture("%s%s.png"%(TexPath, tex))
    obj.setTexture(tex, 1)

  return obj

def IntervalsTurnOff(intervalList):
    for interval in intervalList:
        if interval is not None:
            interval.finish()

